use strict;
use Tk;
use Tk::JComboBox;

my $mw = MainWindow->new();

my @list = (qw/ one two three four five six seven eight nine ten eleven
	twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen
twenty/);
	
my @display = @list;

my $typeCB = $mw->JComboBox(
	-entrybackground => 'white',
	-mode => 'editable',
	-relief => 'sunken',
	-choices => \@display,
	-popupcreate => \&updateComboBoxList
)->pack(qw/-expand 1 -fill x -side left/);

MainLoop();

sub updateComboBoxList
{
	my $jcb = shift;
	my $value = $jcb->getSelectedValue();
	print "value: $value\n";
	
	@display = ();
	foreach my $item (@list)
	{
		if ($item =~ /^$value/)
		{
			print "adding item: $item\n";
			push @display, $item;
		}
	}
	$jcb->Subwidget('Entry')->insert(0, $value);
}
